package com.example.getaudit.task;


import com.example.getaudit.service.CommodityMarketPriceMonthlyService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Configuration
@EnableScheduling
@Component
@Slf4j
public class OutstationGroupbuyTask {
    @Resource
    CommodityMarketPriceMonthlyService commodityMarketPriceMonthlyService;

//    @Scheduled(cron = "0/10 * * * * ?")
    //@Scheduled(cron = "0 0/5 7-18 * * ?")   //五分钟一次更新~
    @Scheduled(cron = "0 0 0 5 * ? ")   //59分钟一次更新~
    public void updateOutstationGroupbuyTask() {
        Logger logger = LoggerFactory.getLogger(this.getClass());
        log.info("【START】【获取商品比价-更新数据库】");
        Boolean aBoolean = commodityMarketPriceMonthlyService.getPriceMonthly();
        log.info("【END】【获取商品比价-更新数据库】updated = {}",aBoolean);
    }

}
